#pragma once

#include "CXSegment.h"

class SegmentTrimAction : public My::Action {
private:
	CXSegment &		m_Segment;
	SegmentDataSPtr	m_pBefore;
public:
	SegmentTrimAction(CXSegment & segm) 
		: m_Segment(segm) { }
public:
	virtual String GetCaption() const
		{ return "Trim Data"; }
protected:
	virtual bool Execute();
	virtual void Unexecute();
};

class SegmentDataAction : public My::Action {
protected:
	CXSegment &		m_Segment;
	SegmentDataSPtr	m_pBefore;
	SegmentDataSPtr	m_pAfter;
public:
	SegmentDataAction(CXSegment & segm)
		: m_Segment(segm) {	}
protected:
	/// Reverts to the "after" data
	void After();
	/// Reverts to the "before" data
	void Before();
public:
	virtual void Unexecute();
	virtual void Reexecute();
};

/** 
 *  Action that changes segment parameters.
 */
class SegmentParamsAction : public SegmentDataAction {
private:
	CXParams	m_Value;
public:
	SegmentParamsAction(CXSegment &, const CXParams & p); 
public:
	virtual String GetCaption() const;
	virtual bool Execute();
};

/** 
 *  Action that changes segment mask.
 */
class SegmentMaskAction : public SegmentDataAction {
private:
	BitMask		m_Value;
	BitMask		m_OldValue;
	String		m_Caption;
public:
	SegmentMaskAction(CXSegment &, const BitMask &, const String &);
	virtual String GetCaption() const;
	virtual bool Execute();
};
